package com.itheima79.googleplay.adapter;

import java.util.ArrayList;

import com.itheima79.googleplay.global.GooglePlayApplication;
import com.itheima79.googleplay.global.ImageLoaderOptions;
import com.itheima79.googleplay.http.Api;
import com.nostra13.universalimageloader.core.ImageLoader;

import android.view.ViewGroup;
import android.widget.ImageView;

public class HomeHeaderAdapter extends BasePagerAdapter<String>{

	public HomeHeaderAdapter(ArrayList<String> list) {
		super(list);
	}
	
	@Override
	public int getCount() {
		return Integer.MAX_VALUE;
	}
	
	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		ImageView imageView = new ImageView(GooglePlayApplication.context);
		
		//显示图片
		ImageLoader.getInstance().displayImage(Api.IMAGE_PREFIX+list.get(position%list.size()), imageView,ImageLoaderOptions.fadein_options);
		
		//需要将imageView添加到container
		container.addView(imageView);
		return imageView;
	}

}
